<?php
defined('IN_IA') or exit('Access Denied');

class qqbb_pppModuleSite extends WeModuleSite {

	public function doMobileIndex() {
			global $_GPC, $_W;
			 $weid = $_GPC['i'];
	 $word=pdo_fetch("select * from " . tablename('qqbb_ppp_words') .  "where  weid= $weid  ORDER BY RAND() LIMIT 1"   );
		     $url=pdo_fetch("select * from " . tablename('qqbb_ppp_url') .  " where  weid = $weid " );
		include $this->template('index');
	}

	public function doWebIndex() {
			global $_GPC, $_W;
		 $weid = $_W['uniacid'];
		 $insert=array();
		 $insert['weid']=$weid; 
	
      	$word11=pdo_fetch("select * from " . tablename('qqbb_ppp_words') .  " where  weid = $weid " );
	     if(empty($word11)){
			$insert['words']='斯人若彩虹，遇上方知有';
			pdo_insert('qqbb_ppp_words', $insert);
		}	   
	 	$words= $_GPC['words'];   		 
	    if(!empty($words)){
			$insert['words']=$words;
			pdo_insert('qqbb_ppp_words', $insert);
		}
	    $word=pdo_fetch("select * from " . tablename('qqbb_ppp_words') .  " where  weid = $weid " );
	   	
      	if(empty($urls)){
		  	 $insert1['weid']=$weid; 
		  	 $insert1['url']='http://qqbb.admin888.site/app/index.php?i=2&c=entry&do=index&m=qqbb_ppp';
		 	pdo_insert('qqbb_ppp_url', $insert1);
	 	 }	   
	
		  $id=$_GPC['id'];
	     $url=$_GPC['url'];
		 if(!empty($id)){
			 $words_content=array(
			         'url'=>$url,
			 );
		 	pdo_update('qqbb_ppp_url',$words_content, array('id'=>$id));
		 } 
		$urls=pdo_fetch("select * from " . tablename('qqbb_ppp_url') .  " where  weid = $weid ");
		include $this->template('index');
	}
	
	
	public function doWebGuanli() {
			global $_GPC, $_W;
		 $insert=array();
		 $op = $_GPC['op'];
     	 $weid = $_W['uniacid'];	     
        if(empty($op))
		{
			$op='all';
		}	
			 $id=$_GPC['id'];
		   if(!empty($id)){
				 pdo_delete('qqbb_ppp_words', array('id' =>$id));
			 } 	
			 $list=pdo_fetchall("select * from " . tablename('qqbb_ppp_words') .  " where  weid = $weid " );
	
			$words_id=$_GPC['words_id'];
		  	$words=$_GPC['words'];
		 	if(!empty($words_id)){
				$words_content=array(
			    	'words'=>$words,
				);
				pdo_update('qqbb_ppp_words',$words_content, array('id' => $words_id));
		 	} 
		 	$list=pdo_fetchall("select * from " . tablename('qqbb_ppp_words') .  " where  weid = $weid " );
		
		
		include $this->template('guanli');
	}
			
			
	
}